package com.btl.service.ai.support.rag.store.vector;

import com.btl.service.ai.support.rag.RagProperties;
import com.btl.service.ai.support.rag.store.vector.collections.VectorStoreQdrantFactory;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class VectorStoreProvider {
    @Bean
    public VectorStoreQdrantFactory embeddingStoreFactory(QdrantClient qdrantClient) {
        return new VectorStoreQdrantFactory(qdrantClient);
    }

    @Bean
    public QdrantClient qdrantClient(RagProperties ragProperties) {
        return new QdrantClient(
                QdrantGrpcClient.newBuilder(ragProperties.getStore().getQdrant().host(), ragProperties.getStore().getQdrant().port(), false)
                        .build());
    }

}
